﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CoinController : MonoBehaviour {

    public static CoinController con;

    public void Awake()
    {
        con = this;
    }
    [Header("金币预制体")]
    public Coin coinPre;

    private AudioSource source;
    public AudioClip au1;
    public AudioClip au2;

    /// <summary>
    /// 掉落金币
    /// </summary>
    /// <param name="a"></param>
    public void CreatCoin(Transform a,int value)
    {
        for (int i = 0; i < value; i++)
        {
            Coin obj = Instantiate(coinPre, a.position, Quaternion.identity);
        }
        source.PlayOneShot(au2);
    }

    public void Au1Play()
    {
        source.PlayOneShot(au1);
    }

	// Use this for initialization
	void Start () {
        source = GetComponent<AudioSource>();
    }
	
	// Update is called once per frame
	void Update () {
		
	}
}
